//
//  OpenEyesCell.m
//  Eyeshot
//
//  Created by lanou3g on 15/6/30.
//  Copyright (c) 2015年 lanou3g.com. All rights reserved.
//

#import "OpenEyesCell.h"
#import "UIImageView+WebCache.h"
@implementation OpenEyesCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH * 0.3)];
        _iconImageView.image = [UIImage imageNamed:@"wxl0"];
        [self.contentView addSubview:_iconImageView];
        
        CGFloat width = _iconImageView.frame.size.width;
        CGFloat height = _iconImageView.frame.size.height;

        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((width - 350) / 2, (height - 30) / 2, 350, 30)];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont boldSystemFontOfSize:18];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"i love you";
        [_iconImageView addSubview:_titleLabel];
        
        _cgAndDurLabel = [[UILabel alloc] initWithFrame:CGRectMake((width - 200) / 2, (height - 30) / 2 + 30, 200, 30)];
        _cgAndDurLabel.textColor = [UIColor whiteColor];
        _cgAndDurLabel.textAlignment = NSTextAlignmentCenter;
        _cgAndDurLabel.text = @"#运动 / 02:55";
        [_iconImageView addSubview:_cgAndDurLabel];
        
    }
    return self;
}

- (void)setOpenEyesModel:(OpenEyesModel *)openEyesModel{
    //重写数据模型的set方法
    [_iconImageView sd_setImageWithURL:[NSURL URLWithString:openEyesModel.coverForDetail]];
    _titleLabel.text = openEyesModel.title;
    
    _cgAndDurLabel.text = [NSString stringWithFormat:@"#%@ / %02d:%02d",openEyesModel.category,openEyesModel.duration / 60,openEyesModel.duration % 60];
}
@end
